package cn.caplike.demo.repository.design.pattern.builder.builder;


import cn.caplike.demo.repository.design.pattern.builder.entity.LogicalTableDescriptor;

/**
 * LogicalTableDescriptor 构建器
 *
 * @author LiKe
 * @date 2019-07-08 19:13
 */
public final class LogicalTableDescriptorBuilder {

    /**
     * 被构建的实例的引用
     */
    private final LogicalTableDescriptor descriptor = new LogicalTableDescriptor();

    private LogicalTableDescriptorBuilder() {
    }

    /**
     * Description: 构建一个实例
     *
     * @return builder.LogicalTableDescriptorBuilder
     * @author LiKe
     * @date 2019-07-08 19:16:09
     */
    public static LogicalTableDescriptorBuilder of() {
        return new LogicalTableDescriptorBuilder();
    }

    /**
     * Description: 构建逻辑表名
     *
     * @param tableName 逻辑表名
     * @return builder.LogicalTableDescriptorBuilder
     * @author LiKe
     * @date 2019-07-08 19:18:56
     */
    public LogicalTableDescriptorBuilder tableName(String tableName) {
        descriptor.setTableName(tableName);
        return this;
    }

    /**
     * Description: 构建逻辑列名
     *
     * @param columnName 逻辑列名
     * @return builder.LogicalTableDescriptorBuilder
     * @author LiKe
     * @date 2019-07-08 19:19:46
     */
    public LogicalTableDescriptorBuilder columnName(String columnName) {
        descriptor.setColumnName(columnName);
        return this;
    }

    /**
     * Description: 执行构建
     *
     * @return LogicalTableDescriptor
     * @author LiKe
     * @date 2019-07-08 19:17:50
     */
    public LogicalTableDescriptor build() {
        return descriptor;
    }
}

